function ChessInGame(chess,team,ai,boss,position){
	this.aiCounter=0;
	this.team=team;
	this.chess=chess;
	this.ai=ai;
	this.boss = boss;
	this.hit = 0;
	this.mp = chess.mp;
	this.position=position;
	this.sprite = new ChessSprite(position,chess,team);
	this.head = new HeadSprite(chess);
	this.sprite.addChild(this.head, 2, "head");
	this.bg = new cc.Sprite(res.gc_item_png, cc.rect(0, 100, 100, 100));
	this.bg.attr({
		anchorX : 0.5,
		anchorY : 0.5,
		x: 50,
		y: 50,
	});
	this.sprite.addChild(this.bg, 3, "bg");
	this.tag = new cc.Sprite(res.gc_item_png, cc.rect(125, 100, 25, 25));
	this.tag.attr({
		anchorX : 0,
		anchorY : 1,
		x: 70,
		y: 95,
	});
	this.sprite.addChild(this.tag, 3, "tag");
	this.hPText = new cc.LabelTTF("","res/font/Microsoft Yahei.ttf", 18);
	this.hPText.attr({
		anchorX : 0,
		anchorY : 0,
		x: 70,
		y: 5,
		color : cc.color(125, 0, 0)
	});
	this.hitText = new cc.LabelTTF("","res/font/Microsoft Yahei.ttf", 18);
	this.hitText.attr({
		anchorX : 0,
		anchorY : 0,
		x: 8,
		y: 5,
		color : cc.color(100, 125, 0)
	});
	this.sprite.addChild(this.hPText, 4, "hp");
	this.sprite.addChild(this.hitText, 4, "hit");
	this.skill = new SSkillLuncher(chess.skill);
	this.effect = new Array();
	this.inChain = false;
	this.id = _UID;
	this.dying = false;
	_UID++;
};

function ChessLoader(id,team,ai,boss,position){
	var chess = new ChessInGame(CFindInData(id),team,ai,boss,position);
	return chess;
};

function CFindInData(id){
	for(var i=0;i<_chess.length;i++){
		if(_chess[i].id == id)
			return _chess[i];
	}
	return null;
};

function CFindByPosition(position){
	if(position.x == undefined || position.y == undefined)
		return null;
	return _board[position.x][position.y];
}

function CFindById(id){
	for(var i in _GDChessList){
		if(_GDChessList[i].id == id)
			return _GDChessList[i];
	}
	return null;
};

function CChessPosition(position){
	return new GDposition(CChessPositionx(position.x), CChessPositiony(position.y));
}

function CChessPositionx(x){
	return 78.35+96.7*x;
}

function CChessPositiony(y){
	return 855-(y*101.2);
}